//
//  User.m
//  NiuBanJinGold
//
//  Created by Billy on 15/9/17.
//  Copyright (c) 2015年 zzjr. All rights reserved.
//

#import "User.h"
#import "LMObjSerialization.h"
@implementation User 

- (void)encodeWithCoder:(NSCoder *)aCoder {
    
    [LMObjSerialization encodeWithCoder:aCoder obj:self];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    self = [super init];
    
    if (self) {
        
        [LMObjSerialization decodeWithCoder:aDecoder obj:self];
    }
    
    return self;
}

- (NSString *)description {
    
    return [LMObjSerialization descriptionWithObj:self];
}

- (instancetype)initWithAttributes:(NSDictionary *)attributesDic {
    
    self = [super init];
    
    if (self) {
        
        self.user_annualRate = [attributesDic objectForKey:@"annualRate"];
        self.user_dayProfit = [attributesDic objectForKey:@"dayProfit"];
        self.user_isCardBinding = [NSNumber numberWithBool:[[attributesDic objectForKey:@"cardBinding"] boolValue]];
        self.user_isRealNameAuthentication = [NSNumber numberWithBool:[[attributesDic objectForKey:@"realnameAuthentication"] boolValue]];
        self.user_userRealName = [attributesDic objectForKey:@"realname"];
        self.user_ticketRate = [attributesDic objectForKey:@"ticketRate"];
        self.user_userAsset = [attributesDic objectForKey:@"asset"];
        self.user_userAssetFree = [attributesDic objectForKey:@"usableAseet"];
        self.user_userAssetFrozen = [attributesDic objectForKey:@"assetFrozen"];
        self.user_userEarnings = [attributesDic objectForKey:@"totalPayoff"];
        self.user_userId = [attributesDic objectForKey:@"userId"];
        self.user_userName = [attributesDic objectForKey:@"username"];
        self.user_userScores = [attributesDic objectForKey:@"scores"];
        self.user_userTicket = [attributesDic objectForKey:@"tickets"];
        self.user_userToken = [attributesDic objectForKey:@"token"];
        self.user_userdayWalletProfit = [attributesDic objectForKey:@"dayWalletProfit"];
        self.user_inviteCode = [attributesDic objectForKey:@"inviteCode"];
    }
    return self;
}
@end
